package com.jack.xiaoer.dto;


import com.jack.xiaoer.constant.AccountStateEnum;
import com.jack.xiaoer.constant.AccountTypeEnum;
import com.jack.xiaoer.constant.LoginTypeEnum;
import com.jack.xiaoer.validator.Groups;
import com.jack.xiaoer.validator.annotation.LoginType;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;

import java.time.Instant;

/**
 * Created by Jackaroo Zhang on 2018/12/6.
 */
public class AccountDTO {

    private Long id;

    @NotEmpty(message = "用户名不能为空", groups = {Groups.Login.class, Groups.Register.class, Groups.Email.class})
    @Length(min = 5, max = 40, message = "用户名长度必须在5~40个字符之间", groups = {Groups.Register.class})
    @Email(message = "邮箱不合法", groups = {Groups.Login.class, Groups.Register.class, Groups.Email.class})
    private String username;

    @NotEmpty(message = "密码不能为空", groups = {Groups.Login.class, Groups.Register.class})
    @Length(min = 5, max = 40, message = "密码长度必须在5~40个字符之间", groups = {Groups.Register.class})
    private String password;

    private String nickName;

    private String avatar;

    private String mobilePhone;

    private String mobileImei;

    private String weixinNumber;

    private String weixinOpenid;

    private AccountTypeEnum accountType;

    private AccountStateEnum state;

    private String lastLoginIp;

    private Instant lastLoginTime;

    @LoginType(message = "登录方式错误", groups = {Groups.Login.class})
    private LoginTypeEnum loginType;

    @NotBlank(message = "验证码不能为空", groups = {Groups.Register.class})
    private String verifyCode;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getMobileImei() {
        return mobileImei;
    }

    public void setMobileImei(String mobileImei) {
        this.mobileImei = mobileImei;
    }

    public String getWeixinNumber() {
        return weixinNumber;
    }

    public void setWeixinNumber(String weixinNumber) {
        this.weixinNumber = weixinNumber;
    }

    public String getWeixinOpenid() {
        return weixinOpenid;
    }

    public void setWeixinOpenid(String weixinOpenid) {
        this.weixinOpenid = weixinOpenid;
    }

    public AccountTypeEnum getAccountType() {
        return accountType;
    }

    public void setAccountType(AccountTypeEnum accountType) {
        this.accountType = accountType;
    }

    public AccountStateEnum getState() {
        return state;
    }

    public void setState(AccountStateEnum state) {
        this.state = state;
    }

    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    public Instant getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Instant lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public LoginTypeEnum getLoginType() {
        return loginType;
    }

    public void setLoginType(LoginTypeEnum loginType) {
        this.loginType = loginType;
    }

    public String getVerifyCode() {
        return verifyCode;
    }

    public void setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
    }

    @Override
    public String toString() {
        return "AccountDTO{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", nickName='" + nickName + '\'' +
                ", avatar='" + avatar + '\'' +
                ", mobilePhone='" + mobilePhone + '\'' +
                ", mobileImei='" + mobileImei + '\'' +
                ", weixinNumber='" + weixinNumber + '\'' +
                ", weixinOpenid='" + weixinOpenid + '\'' +
                ", accountType=" + accountType +
                ", state=" + state +
                ", lastLoginIp='" + lastLoginIp + '\'' +
                ", lastLoginTime=" + lastLoginTime + '\'' +
                ", loginType=" + loginType + '\'' +
                ", verifyCode=" + verifyCode +
                '}';
    }
}
